#pragma once

template<typename T>
class Singleton
{
	static T* mInstance;
public:
	Singleton()
	{
		assert(mInstance == NULL);
		mInstance = static_cast<T*>(this);
	}

	static T* getInstancePtr() {
		assert(mInstance != NULL);
		return mInstance;
	}

	static T& getInstance() {
		return *getInstancePtr();
	}
};

#define InitSingleton(T) T* Singleton<T>::mInstance = NULL;